public class LOL_1 {

    public static void main(String[] args) {

        /**

         * 模拟英雄联盟的伤害计算

         * 只考虑攻击力，护甲，暴击（暴击伤害固定200%），不考虑攻速、技能、攻击特效、装备效果等

         */

        // 装备名称、价值、生命值、攻击力、暴击率(写小数)、护甲

        final String[] EQ_NAME = {"日炎", "冰心", "兰顿", "板甲", "羊刀", "死亡之舞", "海妖", "无尽"};

        final int[] EQ_COST = {2700, 2500, 2700, 2900, 3000, 3200, 3100, 3400};

        final double[] EQ_HP = {350, 0, 350, 300, 0, 0, 0, 0};

        final double[] EQ_ATTK = {0, 0, 0, 0, 35, 60, 50, 80};

        final double[] EQ_CHANCE = {0, 0, 0, 0, 0, 0, 0, 0.25};

        final double[] EQ_ARMOR = {50, 65, 75, 45, 0, 50, 0, 0};



        // 英雄基础生命值，攻击力，护甲，暴击率

        final double BASE_HP = 2460;

        final double BASE_ATTK = 111;

        final double BASE_ARMOR = 110.2;

        final double BASE_CHANCE = 0.0;



        // 英雄1的值

        String hero1Name = "亚索";

        String[] hero1Eq = {"日炎"};

        double hero1HP = BASE_HP;

        double hero1Attack = BASE_ATTK;

        double hero1Armor = BASE_ARMOR;

        double hero1Chance = BASE_CHANCE;

        int hero1Cost = 0;



        // 英雄2的值

        String hero2Name = "永恩";

        String[] hero2Eq = {"冰心"};

        double hero2HP = BASE_HP;

        double hero2Attack = BASE_ATTK;

        double hero2Armor = BASE_ARMOR;

        double hero2Chance = BASE_CHANCE;

        int hero2Cost = 0;



        // 给英雄添加装备提供的属性

        for (int i=0;i<hero1Eq.length;i++){

            for (int j = 0; j < EQ_NAME.length; j++) {

                if (hero1Eq[i].equals(EQ_NAME[j])) {

                    hero1HP += EQ_HP[j];

                    hero1Attack += EQ_ATTK[j];

                    hero1Armor += EQ_ARMOR[j];

                    hero1Chance += EQ_CHANCE[j];

                    hero1Cost += EQ_COST[j];

                    break;

                }

            }

        }

        for (int i=0;i<hero2Eq.length;i++){

            for (int j = 0; j < EQ_NAME.length; j++) {

                if (hero2Eq[i].equals(EQ_NAME[j])) {

                    hero2HP += EQ_HP[j];

                    hero2Attack += EQ_ATTK[j];

                    hero2Armor += EQ_ARMOR[j];

                    hero2Chance += EQ_CHANCE[j];

                    hero2Cost += EQ_COST[j];

                    break;

                }

            }

        }

        // 输出英雄1的信息

        System.out.printf("%s\n装备: %s, 花费: %d, HP: %.0f, 攻击力: %.0f, 护甲: %.1f, 暴击率: %d%%\n",

                hero1Name, String.join(", ", hero1Eq),

                hero1Cost, hero1HP, hero1Attack, hero1Armor, (int)(hero1Chance*100));

        // 输出英雄2的信息

        System.out.printf("%s\n装备: %s, 花费: %d, HP: %.0f, 攻击力: %.0f, 护甲: %.1f, 暴击率: %d%%\n",

                hero2Name, String.join(", ", hero2Eq),

                hero2Cost, hero2HP, hero2Attack, hero2Armor, (int)(hero2Chance*100));



        System.out.println("******************开始战斗******************");

        boolean hero1Turn = true;

        while (hero2HP>0 && hero1HP>0) {

            if (hero1Turn) {

                // 英雄1攻击

                double damage = hero1Attack;

                // 暴击

                if (hero1Chance > Math.random()) {

                    damage *= 2;

                    System.out.print("(💥暴击)");

                }

                // 护甲减伤

                damage =damage*(1-hero1Armor/(hero1Armor+100)) ;

                 hero2HP-= damage;

                System.out.printf("⚔%s->%s(-%.0f)，%s-HP: %.0f  ",

                        hero1Name, hero2Name, damage, hero2Name, hero2HP);

            } else {

                // 英雄2攻击

                double damage = hero2Attack;

                // 暴击

                if (hero2Chance > Math.random()) {

                    damage *= 2;

                    System.out.print("(💥暴击)");

                }

                // 护甲减伤

                damage = damage*(1-hero2Armor/(hero2Armor+100));

                hero1HP -= damage;

                System.out.printf("⚔%s->%s(-%.0f)，%s-HP: %.0f\n",

                        hero2Name, hero1Name, damage, hero1Name, hero1HP);

            }

            hero1Turn= !hero1Turn;

        }

        System.out.println("\n******************战斗结束******************");

        if (hero1HP==0) {

            System.out.printf("%s获胜", hero2Name);

        } else {

            System.out.printf("%s获胜", hero1Name);

        }



    }

}